<?php

class loveModule extends Module {
	/*
	 * 在构造函数中装载所依赖的类或其他文件
	*/
	function __construct() {
		$this->includePhp('love', 'love');
	}
	
	
	/*
	 * 调用插件资源
	*/
	public function call($user, $method, $param) {
		
		switch ($method) {
			case "index":
			    $actId = $param->actId;
				if (!isset($actId)) {
					Output::instance()->resultCode(code_lackof_param);
					return;
				}
			    love::getIndex($param);
			    break;
			case "answer":
			    $actId = $param->actId;
				if (!isset($actId)) {
					Output::instance()->resultCode(code_lackof_param);
					return;
				}
			    love::getAnswer($param);
			    break;
			case "view":
			    $actId = $param->actId;
				if (!isset($actId)) {
					Output::instance()->resultCode(code_lackof_param);
					return;
				}
			    love::getView($param);
			    break;
			case "saveAnswer":
				$actId = $param->actId;
				if (!isset($actId)) {
					Output::instance()->resultCode(code_lackof_param);
					return;
				}
			    love::saveAnswer($param);
			    break;
			case "list":
				$actId = $param->actId;
				if (!isset($actId)) {
					Output::instance()->resultCode(code_lackof_param);
					return;
				}
			    love::getList($param);
			    break;
			case "lovelist":
				$actId = $param->actId;
				if (!isset($actId)) {
					Output::instance()->resultCode(code_lackof_param);
					return;
				}
			    love::getLoveList($param,$param->start,$param->limit);
			    break;
			case "getanswerinfo":
				$actId = $param->actId;
				$regId = $param->regId;
				if (!isset($actId)) {
					Output::instance()->resultCode(code_lackof_param);
					return;
				}
				if (!isset($regId)) {
					Output::instance()->resultCode(code_lackof_param);
					return;
				}
			    love::getAnswerInfo($param);
			    break;
			case "savereceiptor":
				$regId = $param->regId;
				$oid = $param->oid;
				if (!isset($regId)) {
					Output::instance()->resultCode(code_lackof_param);
					return;
				}
				if (!isset($oid)) {
					Output::instance()->resultCode(code_lackof_param);
					return;
				}
			    love::saveReceiptor($param);
			    break;
		}
	}
}


$module = new loveModule();
Module::addModule($module);
?>